package me.yuzho.study.concurrency;

public abstract class IntGenerator {
    
    private volatile boolean canceled = false; //boolean类开保证原子性，volatile保证可视性
    
    public abstract int next();
    
    // Allow this bo be canceled
    public void cancel() { canceled = true; }

    public boolean isCanceled() { return canceled; }
}
